# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=chameleon
pkgver=29.4414287
pkgrel=4
pkgdesc='A tool for evading Proxy categorisation.'
arch=('any')
groups=('blackarch' 'blackarch-networking')
url='https://github.com/mdsecactivebreach/Chameleon'
license=('custom:unknown')
depends=('python' 'python-requests' 'python-dateutil' 'python-beautifulsoup4')
makedepends=('git')
source=("$pkgname::git+https://github.com/mdsecactivebreach/Chameleon.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"

  install -Dm 755 -t "$pkgdir/usr/share/$pkgname" *.py banner.txt
  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  cp -a --no-preserve=ownership modules/ "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

